<template>
    <div class="ma-content-block lg:flex justify-between p-4">
      <!-- CRUD 组件 -->
      <ma-crud :options="options" :columns="columns" ref="crudRef">
      </ma-crud>
    </div>
  </template>
  <script setup>
  import { ref, reactive } from 'vue'
  import waybillServiceShipmentType from '@/api/sea/waybillServiceShipmentType'
  import { Message } from '@arco-design/web-vue'
  import tool from '@/utils/tool'
  import * as common from '@/utils/common'
  import dictHelp from '@/utils/dicthelp'
  const crudRef = ref()
  
  const options = reactive({
    id: 'waybill_sea_service_type',
    rowSelection: {
      showCheckedAll: true
    },
    pk: 'id',
    operationColumn: true,
    operationColumnWidth: 160,
    formOption: {
      viewType: 'drawer',
      width: 600
    },
    api: waybillServiceShipmentType.getList,
    add: {
      show: true,
      api: waybillServiceShipmentType.save,
      auth: ['sea:waybillServiceType:save']
    },
    edit: {
      show: true,
      api: waybillServiceShipmentType.update,
      auth: ['sea:waybillServiceType:update']
    },
    delete: {
      show: true,
      api: waybillServiceShipmentType.deletes,
      auth: ['sea:waybillServiceType:delete']
    }
  })
  
  const columns = reactive([
    {
      title: "主键",
      dataIndex: "id",
      formType: "input",
      addDisplay: false,
      editDisplay: false,
      hide: true,
      commonRules: {
        required: true,
        message: "请输入主键"
      }
    },
    {
      title: "服务名称",
      dataIndex: "name",
      formType: "input",
      search: true,
      commonRules: {
        required: true,
        message: "请输入服务名称"
      }
    },
    {
      title: "状态",
      dataIndex: "status",
      formType: "radio",
      addDefaultValue:1, 
      dict: {
          data:[
              {label:"启用",value:1},
              {label:"禁用",value:0}
          ],
          translation: true
      },
      search: true,
      commonRules: {
        required: true,
        message: "请输入状态"
      }
    },
    {
      title: "类型",
      dataIndex: "type",
      formType: "select",
      dict:{
        name:"waybill_sea_service_type",
        translation: true
      },
      search: true,
      commonRules: {
        required: true,
        message: "请输入类型"
      }
    },
    {
      title: "所属转运单服务",
      dataIndex: "service",
      formType: "select",
      multiple: true,
      dict:dictHelp.waybillServiceType,

    },
    {
      title: "创建时间",
      dataIndex: "created_at",
      formType: "date",
      addDisplay: false,
      editDisplay: false,
      hide: true,
      showTime: true
    },
    {
      title: "更新时间",
      dataIndex: "updated_at",
      formType: "date",
      addDisplay: false,
      editDisplay: false,
      hide: true,
      showTime: true
    },
    {
      title: "删除时间",
      dataIndex: "deleted_at",
      formType: "date",
      addDisplay: false,
      editDisplay: false,
      hide: true,
      showTime: true
    },
    {
      title: "描述",
      dataIndex: "describe",
      formType: "input",
      // search: true
    },
    {
      title: "备注",
      dataIndex: "remark",
      formType: "input",
      addDisplay: false,
      editDisplay: false,
      hide: true
    }
  ])
  </script>
  <script> export default { name: 'sea:waybillServiceType' } </script>